module.exports = (app) => {
  const express = require('express')
  const multer = require('multer')

  const router = express.Router()

  const upload = multer({ dest: __dirname + '/../../uploads' })
  router.post('/upload', upload.single('file'), async (req, res) => {
    const file = req.file
    file.url = `http://localhost:5000/uploads/${file.filename}`
    res.send(file)
  })

  app.use('/api/admin', router)
}